<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .con {
            width:500px;
            border:2px solid red;
            margin:0 auto;
            overflow:hidden;
        }
        .con .item{
            width:100px;
            height:100px;
            text-align:center;
            float:left;
        }
    </style>
</head>
<body>
    <div class = "con" id="con">
        <div class="item">
            <img src="images/animal1.png" />
        </div>
        <div class="item">
            <img src="images/animal2.png" />
        </div>
        <div class="item">
            <img src="images/animal3.png" />
        </div>
        <div class="item">
            <img src="images/animal4.png" />
        </div>
    </div>
</body>
<script>
    var con = document.getElementById("con");
    /**
     * document.getElementByTagName(标签名字)
     * 获取页面特定标签的网页元素的DOM节点对象的数组
     */
    var itemList = con.getElementsByTagName("div");
    console.log(itemList);
    for(var i = 0; i< itemList.length; i++){
        itemList[i].onmouseover = function(){
            this.style.backgroundColor = "blue";
        };
        itemList[i].onmouseout = function(){
            this.style.backgroundColor = "white";
        }
    }
</script>
</html>